package com.joint.core.entity;

import com.joint.base.parent.BaseEntity;
import com.joint.core.bean.PublicEnum;

import javax.persistence.*;
import java.util.Date;

/**
 * Created by dqf on 2015/8/20.
 */
@Entity
@Table(name="sys_dictionary")
public class Dictionary extends BaseEntity{
    /**
     * 类别名称
    * */
    private PublicEnum.DictionaryEnm type;
    /**
     * 当前节点名称
     */
    private String name;
    /**
     * 是否关闭
     */
    private boolean isClosed;
    /**
     * 启用时间
     */
    private Date startDate;
    /**
     * 停用时间
     */
    private Date closedDate;
    /**
     * 当前层级
     */
    private int level;
    /**
     * 父节点
     */
    private Dictionary father;
    /**
     * 是否有孩子节点
     */
    private boolean hasChild;

    @Column(nullable = false)
    @Enumerated(EnumType.STRING)
    public PublicEnum.DictionaryEnm getType() {
        return type;
    }

    public void setType(PublicEnum.DictionaryEnm type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public boolean isClosed() {
        return isClosed;
    }

    public void setClosed(boolean isClosed) {
        this.isClosed = isClosed;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getClosedDate() {
        return closedDate;
    }

    public void setClosedDate(Date closedDate) {
        this.closedDate = closedDate;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    public Dictionary getFather() {
        return father;
    }

    public void setFather(Dictionary father) {
        this.father = father;
    }

    public boolean isHasChild() {
        return hasChild;
    }

    public void setHasChild(boolean hasChild) {
        this.hasChild = hasChild;
    }
}
